<include file="../Public/header.html" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2&services=true"></script>
<script type="text/javascript" src="__PUBLIC__/Js/kim.base.map.js"></script>
<link href="__PUBLIC__/Css/goodDetail.css" rel="stylesheet" type="text/css">
<php>
$_REQUEST['goPageFun']="goPageBSub";//设定分页调用函数
if(empty($bsub_brandid))$bsub_brandid	= $productdata['partner_id'];	//商户id	
$bsub_area_id	= $_REQUEST['area_id'];	//区域id	
$bsub_city_id	= $_REQUEST['city_id'];	//城市id
$bsub_bsubpage 	= service('Brand')->search4UserBSub($bsub_brandid,$bsub_area_id,$bsub_city_id,null,20);
</php>
<div id="store_json_data" class="hidden">
		<php>
		if(count($bsub_bsubpage['data'])>0){
			echo json_encode( format2MapData($bsub_bsubpage['data']) );
		}
		</php>
</div>
<script type="text/javascript" charset="utf-8">
	//class="top_bar top_baron" class="top_bar"  k_changeGroupStylek_changeGroupStyle('list_top',' ul > li','detail','top_bar_on');
 	$(document).ready(function(){
 		var list_top_rel  = 'detail';
 		<php>if(empty($productdata['goods_detail'])){</php>
 			list_top_rel  = 'place';
		<php>}</php>
 		k_changeGroupStyle('list_top',' ul > li',list_top_rel,'top_bar_on');
 		<php>if($productdata['goods_get_type']!='delivery'){</php>
 			initMap("map-box","39.925","116.385",11);
 			cleanAll();
			var store_infos = eval('( ' + $('#store_json_data').html() + ' )');
			store_markers = drawStoreMarkers(store_infos,marker_icon);
		
			//在地图上显示第一个店的信息框
			<php>if(count($bsub_bsubpage['data'])>0){</php>
			var _ttmp_marker = getStoreMarker( "{$bsub_bsubpage['data'][0].id}" );
			if(_ttmp_marker!=null){
				var _infoWindow = getStoreInfoWindow(new BMap.Size(0, _ttmp_marker.marker.getIcon().size.height*(-1) ),_ttmp_marker.storeinfo);
				_ttmp_marker.marker.openInfoWindow(_infoWindow);
			}
			<php>}</php>
		<php>}</php>
 	});

function share(sharetype){
	var baseinfo = {
						url:location.href,
						title:"<php> echo $productdata['goods_title'].'( '.$productdata['partner_title'].' )';</php>",
						pic:encodeURI("<php>echo SITE_URL.getPhotoFromThumb($productdata['goods_icon'],400,400);</php>"),
						comment:"我想要有人送么",
						'':''
					};
	var _w = 86 
	var _h = 50;
	var param = null;
	var baseurl = null;
	if(sharetype=='sina'){
		param = {
			    url:baseinfo.url,
			    type:'6',
			    count:'1', /**是否显示分享数，1显示(可选)*/
			    appkey:'', /**您申请的应用appkey,显示分享来源(可选) 488026493*/
			    title:baseinfo.title, /**分享的文字内容(可选，默认为所在页面的title)*/
			    pic:baseinfo.pic, /**分享图片的路径(可选)*/
			    ralateUid:'', /**关联用户的UID，分享微博会@该用户(可选) 1937126950*/
			    rnd:new Date().valueOf(),
			    '':''
			  };
		baseurl = "http://service.weibo.com/share/share.php";
	}
	if(sharetype=='qq'){
		param = {
			    url:baseinfo.url,
			    site:'<php>echo SITE_URL;</php>',
			    //count:'1', /**是否显示分享数，1显示(可选)*/
			    appkey:'', /**您申请的应用appkey,显示分享来源(可选)*/
			    title:baseinfo.title, /**分享的文字内容(可选，默认为所在页面的title)*/
			    pic:baseinfo.pic, /**分享图片的路径(可选)*/
			    //ralateUid:'1937126950', /**关联用户的UID，分享微博会@该用户(可选)*/
			    //rnd:new Date().valueOf()
			    '':''
			  };
		baseurl = "http://v.t.qq.com/share/share.php";
	}
	//'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;
	if(sharetype=='renren'){
		param = {
				link:baseinfo.url,
			    r:'0',
			    //count:'1', /**是否显示分享数，1显示(可选)*/
			    //appkey:'488026493', /**您申请的应用appkey,显示分享来源(可选)*/
			    title:baseinfo.title,
			    comment:baseinfo.comment,
			    content:baseinfo.comment,
			    //comment:baseinfo.title,
			    //pic:'<php>echo SITE_URL.getPhotoFromThumb($productdata['goods_icon'],400,400);</php>', /**分享图片的路径(可选)*/
			    //ralateUid:'1937126950', /**关联用户的UID，分享微博会@该用户(可选)*/
			    //rnd:new Date().valueOf()
			    '':''
			  };
		baseurl = "http://share.renren.com/share/buttonshare.do";
	}
	if(sharetype=='douban'){
		param = {
				url:baseinfo.url,
			    r:'0',
			    //count:'1', /**是否显示分享数，1显示(可选)*/
			    //appkey:'488026493', /**您申请的应用appkey,显示分享来源(可选)*/
			    title:baseinfo.title,
			    comment:baseinfo.comment,
			    //comment:baseinfo.title+'<a href="">212</a>',
			    //pic:'<php>echo SITE_URL.getPhotoFromThumb($productdata['goods_icon'],400,400);</php>', /**分享图片的路径(可选)*/
			    //ralateUid:'1937126950', /**关联用户的UID，分享微博会@该用户(可选)*/
			    //rnd:new Date().valueOf()
			    '':''
			  };
		baseurl = "http://www.douban.com/recommend/";
	}
	
	if(sharetype=='kaixin'){
		param = {
				rurl:baseinfo.url,
			    r:'0',
			    //count:'1', /**是否显示分享数，1显示(可选)*/
			    //appkey:'488026493', /**您申请的应用appkey,显示分享来源(可选)*/
			    rtitle:baseinfo.title,
			    rcontent:baseinfo.comment,
			    //comment:baseinfo.title+'<a href="">212</a>',
			    //pic:'<php>echo SITE_URL.getPhotoFromThumb($productdata['goods_icon'],400,400);</php>', /**分享图片的路径(可选)*/
			    //ralateUid:'1937126950', /**关联用户的UID，分享微博会@该用户(可选)*/
			    //rnd:new Date().valueOf()
			    '':''
			  };
		baseurl = "http://www.kaixin001.com/repaste/share.php";
	}
	
	if(sharetype=='email'){
		param = {
				subject:baseinfo.title,
			    body:baseinfo.pic+baseinfo.comment,
			    '':''
			   	};
		baseurl = "mailto:";
	}
	
	var temp = [];
	for( var p in param ){
		temp.push(p + '=' + encodeURIComponent( param[p] || '' ) );
	}
	
	window.open(baseurl+"?"+temp.join('&'),"_blank","width=615,height=505");
  	//document.write('<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?' + temp.join('&') + '" width="'+ _w+'" height="'+_h+'"></iframe>')
}
</script>

<!--页面主部-->
<div id="main"> 

<div id="global_body">

<!--头部现在位置-->
  <include file="../Product/Tpl/default/Public/p_top_nav.html" />

<!--主体左部，为商品详情页-->
	<div class="primary_box">
		
		<!--商品概要信息展示，最右上侧-->
		<ul class="info">
			<php>//dump($productdata);</php>
			<!--1. 商品名称-->
			<li class="name"><strong>{$productdata['goods_title']}</strong></li>
			<!--2. 商品品牌以及编号，可以定位到品牌页面，这里的商品品牌是不是使用图标比较好？-->
			<li>商品品牌：<a title="点击查看本品牌所有商品" href="{:U('Product://Brand/detail',array('bid'=>$productdata['partner_id']))}" class="info_a">
							{$productdata['partner_title']}</a></li> 
			<!-- 
			<li>商品编号：<b><span id="goods_id">{$productdata['goods_id']}</span></b></li>
			 -->
			<!--3. 市场价，加删除线-->
			<li>市 场&nbsp;&nbsp;价： <b class="price">{:formatMoney($productdata['shelf_market_price'])}</b></li>
			<!--4. 小心意价格-->
			<li>心 意&nbsp;&nbsp;价： <span class="sell">{:formatMoney($productdata['shelf_out_price'])}</span>&nbsp;&nbsp;已送出&nbsp; <span style="color: #D30200;font-size: 16px;">{$productdata['shelf_send_number']+$productdata['shelf_default_number']}</span>&nbsp;份</li>
			<!--5. 积分相关
			<li style="position:relative; display:inline-block;">
				<span class="jfline">得到积分： <span class="jfsell">{$productdata['shelf_gain_credit']}个积分</span></span> <br />
				<div class="clear"></div>
			</li>
			-->
			
			<li>兑换方式： <span>{$productdata['goods_get_type']|getGoodsGetTypeDesc}</span></li>
			<php>if($productdata['goods_get_type']=='self'){</php>
			<li>兑换地点：
				<a title="查看{:K('SP_COUPON_NM')}能够兑换的所有连锁店地址" href="#goods_place" onclick="k_changeGroupStyle('list_top',' ul > li','place','top_bar_on');
						$('#goods_place').show();$('#goods_spxq').hide();$('#goods_sysm').show();$('#goods_fwcn').show();" class="info_a">查看地点</a></li>
			<php>}</php>
			<php>if($productdata['goods_get_type']=='delivery'){</php>
				<li>兑换地点： 收礼者拨打商家电话（{$productdata['partner_phone']},{$productdata['partner_mobile']}）告知快递地址</li>
			<php>}</php>
			<php>if($productdata['goods_get_type']=='all'){</php>
				<li>兑换地点： 收礼者拨打商家电话（{$productdata['partner_phone']},{$productdata['partner_mobile']}）告知快递地址或到店面进行兑换（<a title="查看{:K('SP_COUPON_NM')}能够兑换的所有连锁店地址" href="#goods_place" onclick="k_changeGroupStyle('list_top',' ul > li','place','top_bar_on');
						$('#goods_place').show();$('#goods_spxq').hide();$('#goods_sysm').show();$('#goods_fwcn').show();" class="info_a">查看地点）</li>
			
			<php>}</php>
			<li>券有效期： <span style="font-size:14px;font-weight:bold;color: #333333;">{:exchangeTimeDesc($productdata['shelf_exchange_time'])}</span></li>
			
			<!-- 画一条横线 -->
			<li class="br_line clear"></li>
			
			<!--9. 购买相关内容-->
			<li id="paykey" style="position:relative;"> 
				<div>
					<table width="300px" height="63" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<php>if($checkresult['isCanOn']){</php>
							<tr>
								<td rowspan="3">
									<a href="{:U('Product://Order/orderEdit',array('shelfid'=>$productdata['shelf_id']))}">
										<img  border="0" src="__PUBLIC__/Images/product/button/btn_givegift.jpg" alt="发送礼物给朋友">
									</a>
								</td>
								<td rowspan="3"></td>
								<td style="text-align:right">
									<a href="javascript:void(0);" 
										callback="javascript:k_docollection({ shelf_id : '{$productdata['shelf_id']}' ,stype : '{:Dict::DESIROUS}' },function(){ });"
										onclick="sendHeEmail(this,'<php>if(empty($user['realname'])){</php>{$user['uname']}<php>}else{</php>{$user['realname']}<php>}</php>');">
										<img width="98" height="30" border="0" 
											src="__PUBLIC__/Images/product/button/btn_askgift.jpg" alt="找他/她帮忙买礼物">
									</a>
								</td>
							</tr>
							<tr>
							</tr>
							<tr>
								<td height="4" colspan="3" style="text-align:right" id="sys_k_show_collection_btn" rel="{$productdata['shelf_id']}">
									<a href="javascript:void(0);" onclick="javascript:k_docollection({ shelf_id : '{$productdata['shelf_id']}' ,stype : '{:Dict::TOBESEND}' },function(){ });"
										id="sys_k_do_collection" <php>if(!empty($collection)){</php>style="display:none;"<php>}</php> >
										<img width="98" height="30" border="0" title="先收藏，以后再买"
											src="__PUBLIC__/Images/product/button/btn_markgift_do.jpg" alt="先收藏，以后再买">
									</a>
									<a href="javascript:void(0);" onclick="javascript:k_cancelcollection({ shelf_id : '{$productdata['shelf_id']}' ,stype : '{:Dict::TOBESEND}' },function(){ });"
										id="sys_k_cancel_collection" style=" <php>if(empty($collection)){</php>display:none;<php>}</php> " >
										<img width="98" height="30" border="0"  title="从收藏列表中删除"
											src="__PUBLIC__/Images/product/button/btn_markgift_cancel.jpg" alt="从收藏列表中删除">
									</a>
								</td>
							</tr>
							<php>}else{</php>
							<tr>
								<td style="text-align:center">
									<font style="font-size:20px;color: #D30200; font-weight: bold;">{$checkresult['desc']}</font>
								</td>
							</tr>
							<php>}</php>
						</tbody>
					</table>
				</div>
			</li>
			
			<li>
				<div class="share2">分享到：</div>
				<div id="deal_share">
					<a href="javascript:void();" onclick="share('sina');" class="sina">新浪</a>
					<a href="javascript:void();" onclick="share('qq');" class="qq" >腾讯</a>
					<a href="javascript:void();" onclick="share('kaixin');" class="kaixin">开心</a>
					<a href="javascript:void();" onclick="share('renren');" class="renren">人人</a>
					<a href="javascript:void();" onclick="share('douban');" class="douban">豆瓣</a>
				</div>
			</li>
			
		</ul>

<style>
#pic_box .peisong{
	display:block;
 	top: 1px;
    color: #FFFFFF;
    height: 22px;
    left: 1px;
    line-height: 22px;
    position: absolute;
    text-align: right;
    width: 25px;
    z-index: 2;
	font-weight: bold;
}
#pic_box .peisong img {
    height: 58px;
    padding: 0px;
    width: 30px;
}
</style>
		<!--商品图片展示，最左上侧-->
		<div class="pic">
			<!--1. 图片盒，目前共四张，用js来控制显示与否-->
			<div id="pic_box">
				<div style="float: left;text-align: center;width:355px;height:355px;overflow: hidden;border:0px solid #EBEBEB;">
					<a 	href="{:U('Product://Index/detailp',array('shelfid'=>$productdata['shelf_id']))}"  class="goods_b"
						title="{$productdata['goods_title']}" >
						<php>if($productdata['goods_get_type']=='delivery'||$productdata['goods_get_type']=='all'){</php>
							<em class="peisong"><img src="__PUBLIC__/Images/global/icon_peisong_1.gif"></em>
						<php>}</php>
        	
						<php>if(!empty($productdata['goods_summary'])){</php>
						<em>商品构成：{$productdata['goods_summary']}</em>
						<span></span>
						<php>}</php>
						<img src="{:getPhotoFromThumb($productdata['goods_icon'],400,400)}" alt="{$productdata['goods_title']}">	
					</a>
				</div>
			</div>
		</div>
		
	
	</div>

<!--右侧的商品推荐以及浏览历史-->
	<div class="sidebar_box">
		<!--1. 推荐列表-->
		<php>if(!empty($relativeProduct)){</php>
		<div style="border: 1px solid #EAEAEA;">
			<dl class="p_visited">
				<dt class="samesort"></dt>
				<!--1.2 推荐物品总单元格-->
				<dd> 
					<volist id="vo" name="relativeProduct">
						<ul style="clear:both;">
							<!--图片-->
							<li class="f_img">
								<a href="{:U('Product://Index/detailp',array('shelfid'=>$vo['shelf_id']))}" 
									title="{$vo['goods_title']}">
									<img src="{:getPhotoFromThumb($vo['goods_icon'],100,100)}" alt="{$vo['goods_title']}">
								</a>
							</li>
							<!--文字-->
							<li style="text-align:left;">
								<a href="{:U('Product://Index/detailp',array('shelfid'=>$vo['shelf_id']))}" title="{$vo['goods_title']}">
									{$vo['goods_title']}
								</a>
							</li>
							<!--价格-->
							<li style="text-align:left;"><span>{:formatMoney($vo['shelf_out_price'])}</span></li>
						</ul>
					</volist>
					<div class="clear"></div>
				</dd>
			</dl>
		</div>
		<div class="blank10"></div>
		<php>}</php>

		<include file="../Product/Tpl/default/Public/product_history_box.html" />
	</div>

<!--详情下面的商品详情、评论、购买咨询以及服务承诺-->
	<div class="primary_box" style="overflow:hidden;">
		
		<!--1. Tab页栏-->
		<div id="list_top" class="list_top">
		<ul >
			<php>if(!empty($productdata['goods_detail'])){</php>
			<li class="top_bar top_bar_on" rel="detail" 
				onclick="k_changeGroupStyle('list_top',' ul > li','detail','top_bar_on');
						$('#goods_spxq').show();$('#goods_place').show();$('#goods_sysm').show();$('#goods_fwcn').show();
						">商品详情</li>
			<php>}</php>
			
			<li class="top_bar top_bar_on" rel="place"
				onclick="k_changeGroupStyle('list_top',' ul > li','place','top_bar_on');
						$('#goods_place').show();$('#goods_spxq').hide();$('#goods_sysm').show();$('#goods_fwcn').show();
						">兑换地点</li>

			<li class="top_bar" rel="service"
				onclick="k_changeGroupStyle('list_top',' ul > li','service','top_bar_on');
						$('#goods_fwcn').show();$('#goods_spxq').hide();$('#goods_sysm').hide();$('#goods_place').hide();
						">服务承诺</li>
		</ul>
	</div>
		
		<div style="float:right;width:210px">
			<php>if($productdata["partner_explain"] || ($productdata['goods_get_type']=='delivery'||$productdata['goods_get_type']=='all') ){</php>
				<div class="details">
					<div class="details_top_short">注意事项</div>
					<dl style="padding:2px 0px;color: #CC0000;" class="intro_pay">
						<dd>
						<php>if(($productdata['goods_get_type']=='delivery'||$productdata['goods_get_type']=='all') ){</php>
						<p>此礼品无需到店自取！心意券中将写明兑换确认电话。收礼人拨打店家兑换电话，店家验证后发货。</p>
						<php>}</php>
						<php>if($productdata["partner_explain"]){</php>
							{$productdata["partner_explain"]}
						<php>}</php>
						</dd>
					</dl>
		   	 		<div class="blank10"></div>
		   	 	</div>
			<php>}</php>
		
			<!--5. 使用说明-->
			<div class="details" >
				<div class="details_top_short">心意券使用说明</div>
				<include file="../Product/Tpl/default/Public/goods_sysm_box.html" />
		        <div class="blank10"></div>
			</div>
		</div>
		<div style="float:left;width:510px">
			<php>if(!empty($productdata['goods_detail'])){</php>
			<!--2. 商品详情-->
			<div class="details" id="goods_spxq">
			{$productdata['goods_detail']}
			<!--  
				<div class="details_top">商品详情</div>
				<div class="gs_box" style="line-height: 25px;">   
					<p>
						{$productdata['goods_detail']}
					</p>
				</div>
				<div class="blank10"></div>
		        <div class="blank10"></div>
		        <div class="blank10"></div>
		    -->
			</div>
			<php>}</php>
			<!--5. 使用说明-->
			<div class="details" id="goods_place">
				<div class="details_top">兑换地点</div>
				<php>if($productdata['goods_get_type']=='self'){</php>
					<span style="line-height:25px;">到如下店面进行兑换：</span>
					<div id="map-box" style="width:508px;" >
		        	</div>
				<php>}</php>
				<php>if($productdata['goods_get_type']=='delivery'){</php>
					<span style="line-height:25px;">拨打商家电话（{$productdata['partner_phone']},{$productdata['partner_mobile']}）告知快递地址。</span>
				<php>}</php>
				<php>if($productdata['goods_get_type']=='all'){</php>
					<span style="line-height:25px;">拨打商家电话（{$productdata['partner_phone']},{$productdata['partner_mobile']}）告知快递地址或到如下店面进行兑换：</span>
					<div id="map-box"  style="width:508px;">
		        	</div>
				<php>}</php>
				
		        <div class="blank10"></div>
		        <div class="blank10"></div>
		        <div class="blank10"></div>
			</div>
			
			<!--5. 服务承诺-->
			<div class="details" id="goods_fwcn">
				<div class="details_top">服务承诺</div>
				<include file="../Product/Tpl/default/Public/goods_fwcn_box.html" />
				<div class="blank10"></div>
		        <div class="blank10"></div>
		        <div class="blank10"></div>
			</div>
		</div>
	</div>
	<div class="clear"></div>

</div>

</div>

<include file="../Public/footer.html" />